package com.example.brazil_project.function;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import com.example.brazil_project.AddProductActivity;
import com.example.brazil_project.ArriveMsgActivity;
import com.example.brazil_project.ArriveProductDetailActivity;
import com.example.brazil_project.ArriveProductInfoActivity;
import com.example.brazil_project.DucumentActivity;
import com.example.brazil_project.DucumentDetailActivity;
import com.example.brazil_project.PopularizeProductInfoActivity;
import com.example.brazil_project.RedactDocumentDetailActivity;
import com.example.brazil_project.SearchProductActivity;
import com.example.brazil_project.SysMsgInfoActivity;
import com.example.brazil_project.parameter.Parameter;
import com.example.brazil_project.util.HttpUtil;
import com.example.brazil_project.util.IOUtil;
import com.example.brazil_project.util.ImageCutUtil;
import com.example.brazil_project.util.JSFunction;
import com.example.brazil_project.util.ParameterUtil;
import com.example.brazil_project.util.SQLiteDatabaseUtil;
import com.example.brazil_project.util.StringUtils;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.webkit.WebView;

public class ArriveProductInfoFunction {
	Activity mContxt;  
	WebView webview;
	 public ArriveProductInfoFunction(Activity mContxt,Object webview) {  
	        this.mContxt = mContxt;  
	        this.webview = (WebView) webview;
	  }  
	
	 //跳转到货产品列表
	 public void gotoArriveProduct(String id,String username){
		 Intent intent = new Intent(mContxt, ArriveProductInfoActivity.class);
		 intent.putExtra("id", id);
		 intent.putExtra("username", username);
		 readArrMsg(id,username);
		 mContxt.startActivity(intent);
	 }
	 
	 //跳转到推广信息的产品列表
	 public void gotoPopularizeProduct(String id,String username){
		 Intent intent = new Intent(mContxt, PopularizeProductInfoActivity.class);
		 intent.putExtra("id", id);
		 intent.putExtra("username", username);
		 readArrMsg(id,username);
		 mContxt.startActivity(intent);
	 }
	 
	
	 
	 //获取传进来的信息ID
	 public String getmsgid(){ 
		 Intent intent = mContxt.getIntent();
		 String id = intent.getStringExtra("id");
		return id;
	 }
	 
	 //获取传进来的信息username
		 public String getusername(){ 
			 Intent intent = mContxt.getIntent();
			 String id = intent.getStringExtra("username");
			return id;
		 }
		 
		 //跳转到货产品详情
		 public void gotoArriveProductDetail(String id){
			 String username = mContxt.getIntent().getStringExtra("username");
			 Intent intent = new Intent(mContxt, ArriveProductDetailActivity.class);
			 intent.putExtra("du_id", id);
			 intent.putExtra("username", username);
			 mContxt.startActivity(intent);
		 }
	
		 
		 
		 //修改到货信息为已读
		 public void readArrMsg(String id ,String username){
			 Public_method a = new Public_method(mContxt);
			 String selectsql = "update ArriveInform_table set isread = '1' where  id="+id+" and username = '"+a.getLoginUserName()+"'";
			 SQLiteDatabaseUtil.insert(selectsql);
			 
		 }
		 
		 
		  
}
